package com.zkca.xf.ui.activity.me;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;

import com.zkca.xf.R;
import com.zkca.xf.base.BaseTitleActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class VersionsActivity extends BaseTitleActivity {
    @BindView(R.id.tv_versions)
    TextView tv_versions;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_versions);
        ButterKnife.bind(this);
        setTitleText("版本信息");
        setleftTextVisibility(true);
        setleftImgVisibility(true);
        initData();
    }

    protected void initData() {
        String version = getVersion();
        tv_versions.setText(version);
    }

    public String getVersion() {
        try {
            PackageManager manager = this.getPackageManager();
            PackageInfo info = manager.getPackageInfo(this.getPackageName(), 0);
            String version = info.versionName;
            return "V：" + version;
        } catch (Exception e) {
            e.printStackTrace();
            return "找不到版本号";
        }
    }
}
